/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.reg;

import java.util.Arrays;

/**
 * <p>Project: jse2302 - RegExp3
 * <p>Powered by webrx On 2023-06-20 14:03:59
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class RegExp3 {
    public static void main(String[] args) {
        //"".split() 将字符串分成字符串数组
        String[] langs = "java,php,c,python".split(",");
        System.out.println(Arrays.toString(langs));

        // \d+  也可以写成 [0-9]+  [0-9]{1,}  [0-9]
        // \d 代表 [0-9] + 代表 {1,}  \\d+  [0-9]{1,}
        String[] ls = "java24242php24246c6python000000javascript".split("\\d+");
        System.out.println(Arrays.toString(ls));

        String[] ws = """
                Lorem ipsum  dolor sit amet, consectetur adipisicing elit. Voluptate numquam rerum explicabo ut similique accusamus esse
                """.split("[\\s\\.,]+");
        System.out.println(Arrays.toString(ws));


        //"".replaceAll()
        System.out.println("0java18java99ja99va124mysql00000000".replace("a","b"));
        System.out.println("0java18java99ja99va124mysql00000000".replace("0",""));
        System.out.println("0java18java99ja99va124mysql00000000");
        System.out.println("0java18java99ja99va124mysql0\\d0000000");
        System.out.println("0java18java99ja99va124mysql00000000".replaceAll("\\d",""));


        //"".replaceFirst()
        System.out.println("0java18java99ja99va124mysql00000000".replaceFirst("\\d",""));


        //"".matches()
        //判断字符串是不是纯汉字组成的
        System.out.println("张三丰".matches("[\\u4e00-\\u9fa5\\s]+"));
        //判断字符串是有没有汉字
        System.out.println("李四sir".matches(".*[\\u4e00-\\u9fa5]+.*"));

        System.out.println("hellojava".contains("java"));
        System.out.println("hellojava".indexOf("java")!=-1);

    }
}
